#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    ui->lineEdit_phoneNumber->setPlaceholderText("input your phone number!!!");
    QRegExp regexp("^1\\d{10}$");
    ui->lineEdit_phoneNumber->setValidator(new QRegExpValidator(regexp));
}

Widget::~Widget()
{
    delete ui;
}


void Widget::on_pushButton_submit_clicked()
{
    close();
}

void Widget::on_lineEdit_phoneNumber_textChanged(const QString &arg1)
{
    QString content = arg1;
    int pos = 0;
    if(ui->lineEdit_phoneNumber->validator()->validate(content,pos) == QValidator::Acceptable)
    {
        ui->pushButton_submit->setEnabled(true);
    }
    else
    {
        ui->pushButton_submit->setEnabled(false);
    }

}
